package com.springboot.rigger.prevent;

import com.springboot.rigger.dto.CommonResult;
import com.springboot.rigger.enums.BusinessExceptionEnum;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:
 * @title: MyController
 * @Author Star_Chen
 * @Date: 2022/10/11 9:45
 * @Version 1.0
 */
public class MyController {

    @ResponseBody
    @GetMapping(value = "/testPrevent")
    @Prevent //加上该注解即可实现短信防刷(默认一分钟内不允许重复调用，支持扩展、配置）
    public CommonResult testPrevent() {
        return CommonResult.success(BusinessExceptionEnum.SUCCESS,"调用成功");
    }

    @ResponseBody
    @GetMapping(value = "/testPreventIncludeMessage")
    @Prevent(message = "10秒内不允许重复调多次", value = "10")//value 表示10表示10秒
    public CommonResult testPreventIncludeMessage() {
        return CommonResult.success(BusinessExceptionEnum.SUCCESS, "调用成功");
    }
}
